package pong.game.open_gl;

import javax.microedition.khronos.opengles.GL10;

import pong.game.objects.GL_Helper;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;

public class TextureOpenGL {

	private int openGLId = 0;
	private int resourceId = 0;
	private int countHrefs = 0;
	private boolean fastTexture = false;

	public int getOpenGLIdTexture(GL10 gl, Context context, int resourceId) {

		Bitmap bitmap = BitmapFactory.decodeResource(context.getResources(), resourceId);
		openGLId = GL_Helper.loadGLTexture(gl, bitmap, fastTexture);
		bitmap = null;

		return openGLId;
	}

	public void minusCounter() {
		countHrefs--;
	}

	public void addCounter() {
		countHrefs++;
	}

	public boolean isUsed() {
		return countHrefs > 0;
	}

	public int getOpenGLId() {
		return openGLId;
	}

	public void setOpenGLId(int openGLId) {
		this.openGLId = openGLId;
	}

	public int getResourceId() {
		return resourceId;
	}

	public void setResourceId(int resourceId) {
		this.resourceId = resourceId;
	}

	public boolean isFastTexture() {
		return fastTexture;
	}

	public void setFastTexture(boolean fastTexture) {
		this.fastTexture = fastTexture;
	}
}
